As a data storage medium in a storage apparatus, a randomly accessible non-volatile storage medium, such as a magnetic disc or an optical disc, has been used in the prior art. In particular, a storage apparatus including a lot of small disc drives has recently been used in many cases.
Meanwhile, a non-volatile semiconductor memory capable of batch-erasure has been developed as a result of recent progress of the semiconductor technology, and a storage apparatus using such a non-volatile semiconductor memory as a storage medium has also been developed. Such a non-volatile semiconductor memory may be realized as, for example, a flash memory. A storage apparatus using a flash memory as the storage medium is considered to be more power saving, capable of higher access and the like compared to the storage apparatus including a lot of small disc drives.
The flash memory is not able to directly rewrite data for areas where data has already been recorded. A possible method for realizing rewriting of recorded data, therefore, may be reading and erasing the recorded data in a recorded area, and writing update data in the erased unwritten area. However, as the erasure time is longer than writing time in the flash memory, it is inefficient to execute the erasure every time the data is rewritten.
A typical method that has been adopted to write data, therefore, is a method for first reading old data and combining it with write data to create update data, and writing the created update data in another unwritten area other than the area (original storage area) where the old data is stored, to thereby invalidate the original recorded area. Invalidating the storage area herein indicates processing to prohibit consultation of the storage area by a higher-positioned apparatus. When the unwritten area is gradually consumed and finally depleted, a method for executing the erasure for the area that has been invalidated and creating a new unwritten area is adopted.
Writing to the flash memory needs to be performed for each page. The erasure of the flash memory needs to be performed for each block that includes a plurality of pages. Deterioration of the blocks of the flash memory progresses as a result of repeated erasure, and the possibility of occurrence of bit errors increases. More bit errors occur in the deteriorated blocks as time passes after data has been written. As a relief measure for data breakage caused by the bit errors, a method for adding parity to the write data according to an error correction code (ECC) during data writing while correcting the errors using the parity during data reading may be used.
If, however, the data is left for a long time, such as 6 months, after the data has been written, the number of bit errors is larger than the error correction ability provided by the added parity, and the recorded data becomes unrecoverable. To prevent this, the recorded data is regularly read from all blocks to execute error correction processing, while the degree of deterioration is checked by recording the number of correction bits as an index of deterioration degree. According to the degree of deterioration of the blocks represented by the number of correction bits, the data can be protected before it becomes unrecoverable.
A technique disclosed in PTL 1 can be used herein as a data protecting technique. In the technique disclosed in PTL 1, when the number of correction bits in a page is larger than a first reference value, the recorded data of the page is migrated to another page where the number of correction bits is equal to or smaller than the first value. Further, when the number of correction bits in a page is larger than a second reference value, the use of the page is disabled.